package cn.felord.reactor.flux.conf;

import cn.felord.reactor.flux.factory.SomeService;
import cn.felord.reactor.flux.factory.TaskFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Dax
 * @since 22:21  2019-08-10
 */
@Configuration
public class Config {




    @Bean
    public TaskFactoryBean customTask() {
        TaskFactoryBean taskFactoryBean = new TaskFactoryBean();
        taskFactoryBean.setCronExpression("0 15 10 * * ?");
        String word = "定时任务一";
        SomeService someService = new SomeService();
        someService.setWord(word);
        taskFactoryBean.setSomeService(someService);
        return taskFactoryBean;
    }

    @Bean
    public TaskFactoryBean otherTask() {
        TaskFactoryBean taskFactoryBean = new TaskFactoryBean();
        taskFactoryBean.setCronExpression("0 15 17 * * ?");
        String word = "定时任务二";
        SomeService someService = new SomeService();
        someService.setWord(word);
        taskFactoryBean.setSomeService(someService);
        return taskFactoryBean;
    }
}
